package com.mo.modular.example;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.mo.common.SimpleObject;

/**
 * 常规控制器
 *
 * @author chenxiaodong
 * @date 2018-08-23 16:02
 */
@Controller
@RequestMapping("/hello")
public class ExampleController {

    @RequestMapping(value = "/helloPost", method = RequestMethod.POST)
    public ResponseEntity helloPost(@RequestBody SimpleObject simpleObject) {//@RequestBody//@RequestParam("simpleObject")
        System.out.println(simpleObject.getUser());
        return ResponseEntity.ok("请求成功!");
    }
    @RequestMapping(value = "/helloGet", method = RequestMethod.GET)
    public ResponseEntity helloGet(@RequestParam("user") String user) {//@RequestBody//@RequestParam("simpleObject")
        System.out.println(user);
        return ResponseEntity.ok("请求成功!");
    }
}
